<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Setup.aspx.cs" Inherits="Setup"
	Title="Getting Started - ModWatch" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageContent" Runat="Server">

	<h2>Getting Started</h2>

	<p>
		Setting up a page to use the ModWatch framework is as easy as modifying the page
		to implement the IModWatchContainer interface.  This interface defines a single
		property that provides the ModWatch framework with a method of collecting information
		about controls contained on the page.
	</p>

	<pre>
public partial class Controls : System.Web.UI.Page, IModWatchContainer
{
    private ModManager _modManager;
    public ModManager ModManager
    {
        get
        {
            if (_modManager == null)
                _modManager = new ModManager();
            return _modManager;
        }
    }
}</pre>

	<p>
		Now the ModWatch framework is available for use.  Tracking and notifying a user
		of changes is accomplished by three types of classes:
	</p>

	<ul>
		<li>
			IModWatcher:
			<div style="padding-left: 10px;">
				The IModWatcher interface defines the members of a class that can track
				any changes that have been made.  The ModWatch framework provides a collection of
				ModWatcher extender controls that allow the common input controls to be tracked.
			</div>
		</li>
		<li>
			ModAlert:
			<div style="padding-left: 10px;">
				The ModWatch framework provides a collection of ModAlert extender controls that
				determine whether or not changes have been made, and notify the user if changes
				are found.
			</div>
		</li>
		<li>
			AlertBehaviorBase (optional):
			<div style="padding-left: 10px;">
				Defines a base class for controls that define how a user should be notified
				if changes are found.
			</div>
		</li>
	</ul>

	<p>
		To get started with the ModWatch framework, simply attach a ModWatcher extender control
		to each input control for which changes should be tracked.
	</p>

	<pre>
&lt;asp:TextBox ID="txtTest" runat="server">&lt;/asp:TextBox>
&lt;mw:TextBoxModWatcherExtender runat="server"
        ModGroup="TestGroup" TargetControlID="txtTest" /></pre>

	<p>
		By attaching this ModWatcherExtender, any changes to the TextBox will be tracked.
		Notice that each ModWatcher control contains a ModGroup property.
		This property can be used to group ModWatcher controls in the same
		way that Validator controls can be grouped by the ValidationGroup propery.
		<br />
		For more information about ModWatcher controls, see the
		<asp:HyperLink NavigateUrl="~/ModWatcher/ModWatcherOverview.aspx" runat="server">ModWatcher Overview</asp:HyperLink>.
	</p>

	<p>
		Now that changes to the TextBox control are being tracked, the next step is to
		determine the events that should trigger the ModWatch framework to check for changes.
		This is done by attaching ModAlertExtender controls to controls that should cause
		the ModWatch framework to query for any changes.
		A common scenario would be to check for changes when the user clicks a Button or HyperLink.
		This can be accomplished with the OnClickModAlertExtender control.
	</p>

	<pre>
&lt;asp:Button Text="Test Change Button" ID="btnTest" runat="server" />
&lt;mw:OnClickModAlertExtender runat="server"
        NotifyModMessage="Changes have been detected. Are you sure you want to continue?"
        ModGroup="TestGroup" TargetControlID="btnTest" /></pre>

	<p>
		Notice that a NotifyModMessage property is set.  This property specifies the 
		text that should be displayed to the user if a change exists.
		<br />
		For more information about ModAlert controls, see the
		<asp:HyperLink NavigateUrl="~/ModAlert/ModAlertOverview.aspx" runat="server">ModAlert Overview</asp:HyperLink>.
	</p>
	<p>
		An alternative to setting the NotifyModMessage property of a ModAlertExtender control
		is to provide an AlertBehavior control that specifies how the user should be notified.
	</p>
	<p>
		AlertBehavior controls provide different methods of user notification
		when a change has occurred.  If a ModAlert control does not specify an AlertBehavior,
		then the user will be notified of changes via a confirm dialog box.
		The sample below shows the ConfirmDialogAlertBehavior that provides an alternate
		method of alerting the user of a change with a confirm dialog box.
	</p>

	<pre>
&lt;mw:ConfirmDialogAlertBehavior ID="cdaConfirmChange" runat="server"
        NotifyModMessage="Changes have been detected. Are you sure you want to continue?" />

&lt;asp:Button Text="Test Change Button" ID="btnTest" runat="server" />
&lt;mw:OnClickModAlertExtender runat="server"
        AlertBehaviorID="cdaConfirmChange"
        ModGroup="TestGroup" TargetControlID="btnTest" /></pre>

	<p>
		For more information about AlertBehavior controls, see the
		<asp:HyperLink NavigateUrl="~/AlertBehavior/AlertBehaviorOverview.aspx" runat="server">AlertBehavior Overview</asp:HyperLink>.
	</p>

</asp:Content>
